package jobs.job3.classloaderdemo.server.standard.serializer;


import jobs.job3.classloaderdemo.server.util.Utils;

// 任务的 输入输出 序列化器
public class SerializerImp<I, O> implements IOSerializer<I, O> {


    @Override
    public byte[] inputSerialize(I obj) throws Exception {
        return Utils.convertToBytes(obj);
    }

    @Override
    public I inputDeserialize(byte[] bytes) throws Exception {
        return Utils.bytesToObject(bytes);
    }

    @Override
    public byte[] outputSerialize(O obj) throws Exception {
        return Utils.convertToBytes(obj);
    }

    @Override
    public O outputDeserialize(byte[] bytes) throws Exception {
        return Utils.bytesToObject(bytes);
    }
}
